add xmlstreamwriter methods analogous to QXmlStreamWriter that strip illegal characters.
authortsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 12 Sep 2013 22:14:07 +0000 (22:14 +0000)
committertsteven4 <tsteven4@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Thu, 12 Sep 2013 22:14:07 +0000 (22:14 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4606 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/Makefile.in
gpsbabel/gpx.cc
gpsbabel/reference/LineStyles.gpx
gpsbabel/src/core/xmlstreamwriter.cc [new file with mode: 0644]
gpsbabel/src/core/xmlstreamwriter.h

index 9d95cf925f13a285e12cd1814fde7fa74d6db649..9206997506383aebad861ca3cfe0421d19577908 100644 (file)
@@ -112,7 +112,7 @@ LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \
           csv_util.o strptime.o grtcirc.o util_crc.o xmlgeneric.o \
           formspec.o xmltag.o cet.o cet_util.o fatal.o rgbcolors.o \
          inifile.o garmin_fs.o gbsleep.o units.o @GBSER@ gbser.o \
-         gbfile.o parse.o session.o \
+         gbfile.o parse.o session.o src/core/xmlstreamwriter.o \
        $(PALM_DB) $(GARMIN) $(JEEPS) $(SHAPE) @ZLIB@ $(FMTS) $(FILTERS)
 OBJS = main.o globals.o $(LIBOBJS) @FILEINFO@
 
@@ -1024,6 +1024,8 @@ smplrout.o: smplrout.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h \
   filterdefs.h grtcirc.h
 sort.o: sort.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
   cet.h cet_util.h inifile.h session.h src/core/datetime.h filterdefs.h
+src/core/xmlstreamwriter.o: src/core/xmlstreamwriter.cc \
+  src/core/xmlstreamwriter.h
 stackfilter.o: stackfilter.cc defs.h config.h queue.h zlib/zlib.h \
   zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h session.h \
   src/core/datetime.h filterdefs.h
index b623d25f2f7a0a6a8e24d8bc8734c8d15bc2133a..77b9c94ab9ba79dbb1aae214cab36e9c3091f7dd 100644 (file)
@@ -1544,22 +1544,12 @@ gpx_write_common_description(const waypoint* waypointp, QString oname)
 {
   writer->writeOptionalTextElement("name", oname);
 
-  // FIXME: the replace() nonsense here is to prevent bogus control
-  // characters from being embedded in the output stream. The only place
-  // this happens in our test suite is a ^Z in the German Garmin GPI test
-  // file.  Filter that out in the two fields below... Ideally, we should
-  // probably filter that in the input rather than here.
-
-  QString desc = QString::fromUtf8(waypointp->description);
-  desc = desc.replace(QRegExp("[\014-\032]"), " ");
-  writer->writeOptionalTextElement("cmt", desc);
+  writer->writeOptionalTextElement("cmt", waypointp->description);
 
   if (waypointp->notes && waypointp->notes[0]) {
-    QString note = QString::fromUtf8(waypointp->notes);
-    note = note.replace(QRegExp("[\014-\032]"), " ");
-    writer->writeTextElement("desc", note);
+    writer->writeTextElement("desc", waypointp->notes);
   } else {
-    writer->writeOptionalTextElement("desc", QString::fromUtf8(waypointp->description));
+    writer->writeOptionalTextElement("desc", waypointp->description);
   }
 
   write_gpx_url(waypointp);
@@ -1701,8 +1691,8 @@ gpx_route_hdr(const route_head* rte)
 {
   fs_xml* fs_gpx;
   writer->writeStartElement("rte");
-  writer->writeOptionalTextElement("name", QString::fromUtf8(rte->rte_name));
-  writer->writeOptionalTextElement("desc", QString::fromUtf8(rte->rte_desc));
+  writer->writeOptionalTextElement("name", rte->rte_name);
+  writer->writeOptionalTextElement("desc", rte->rte_desc);
 
   if (rte->rte_num) {
     writer->writeTextElement("number", QString::number(rte->rte_num));
index ee291e4cb4531b3e203fe501b86c117804043704..7db20e3cd572a94f35aed3f581a2314450426442 100644 (file)
   </wpt>
   <wpt lat="37.522060037" lon="-122.277670026">
     <name>NOTE 1</name>
-    <cmt>12 test lines - see notes with GPX sample!! four line widths for solid red two line widths for dashed red seven colors for medium width Note that line names have nothing at all to do with line style attributes!\vThese are named for convenient cross-reference,    but keep in mind that &quot;red med&quot; is a line label and &quot;Red Medium&quot; is a style label. Waypoints are generated by Topo to exactly match the first track point. Apparently only GPX and KML output from GPSBabel retain track descriptions??</cmt>
-    <desc>12 test lines - see notes with GPX sample!! four line widths for solid red two line widths for dashed red seven colors for medium width Note that line names have nothing at all to do with line style attributes!\vThese are named for convenient cross-reference,    but keep in mind that &quot;red med&quot; is a line label and &quot;Red Medium&quot; is a style label. Waypoints are generated by Topo to exactly match the first track point. Apparently only GPX and KML output from GPSBabel retain track descriptions??</desc>
+    <cmt>12 test lines - see notes with GPX sample!!\rfour line widths for solid red\rtwo line widths for dashed red\rseven colors for medium width\rNote that line names have nothing at all to do with line style attributes! These are named for convenient cross-reference,\r   but keep in mind that &quot;red med&quot; is a line label and &quot;Red Medium&quot; is a style label.\rWaypoints are generated by Topo to exactly match the first track point.\rApparently only GPX and KML output from GPSBabel retain track descriptions??</cmt>
+    <desc>12 test lines - see notes with GPX sample!!\rfour line widths for solid red\rtwo line widths for dashed red\rseven colors for medium width\rNote that line names have nothing at all to do with line style attributes! These are named for convenient cross-reference,\r   but keep in mind that &quot;red med&quot; is a line label and &quot;Red Medium&quot; is a style label.\rWaypoints are generated by Topo to exactly match the first track point.\rApparently only GPX and KML output from GPSBabel retain track descriptions??</desc>
   </wpt>
   <wpt lat="37.522349358" lon="-122.284910083">
     <name>NOTE 2</name>
-    <cmt>how GPX from GPSBabel shows Topo track desc as of 2012: (line name and line style are NOT related to actual color or width)  &lt;trk&gt;   &lt;name&gt;red line&lt;/name&gt;   &lt;desc&gt;Style=red med, Width=3, Dashed=0, Color=#ff0000&lt;/desc&gt; &lt;number&gt;1&lt;/number&gt; &lt;trkseg&gt; ... (Topo menu colors are stored in the file as web-style hex RGB)   Red=#ff0000, Yellow=#ffff00, Green=#008000, Blue=#000080,   Purple=#800080, Black=#000000, White=#ffffff (Topo solid  line widths: Hairline=1, Thin=2, Medium=3, Thick=4) (Topo dashed line widths: Hairline=1, Thin=2) SRE's tpo.c mod stuffs Style/Width/Dashed/Color fields into &quot;desc&quot; field   under the assumption that something will post-process GPX or KML output   and move information from desc to private extensions (solid  lines have &quot;Dashed=0&quot;, can have width of 1=hairline to 4=thick) (dashed lines have &quot;Dashed=1&quot;, can only have width of 1=hairline or 2=thin) </cmt>
-    <desc>how GPX from GPSBabel shows Topo track desc as of 2012: (line name and line style are NOT related to actual color or width)  &lt;trk&gt;   &lt;name&gt;red line&lt;/name&gt;   &lt;desc&gt;Style=red med, Width=3, Dashed=0, Color=#ff0000&lt;/desc&gt; &lt;number&gt;1&lt;/number&gt; &lt;trkseg&gt; ... (Topo menu colors are stored in the file as web-style hex RGB)   Red=#ff0000, Yellow=#ffff00, Green=#008000, Blue=#000080,   Purple=#800080, Black=#000000, White=#ffffff (Topo solid  line widths: Hairline=1, Thin=2, Medium=3, Thick=4) (Topo dashed line widths: Hairline=1, Thin=2) SRE's tpo.c mod stuffs Style/Width/Dashed/Color fields into &quot;desc&quot; field   under the assumption that something will post-process GPX or KML output   and move information from desc to private extensions (solid  lines have &quot;Dashed=0&quot;, can have width of 1=hairline to 4=thick) (dashed lines have &quot;Dashed=1&quot;, can only have width of 1=hairline or 2=thin) </desc>
+    <cmt>how GPX from GPSBabel shows Topo track desc as of 2012:\r(line name and line style are NOT related to actual color or width)\r\r&lt;trk&gt;\r  &lt;name&gt;red line&lt;/name&gt;\r  &lt;desc&gt;Style=red med, Width=3, Dashed=0, Color=#ff0000&lt;/desc&gt;\r&lt;number&gt;1&lt;/number&gt;\r&lt;trkseg&gt;\r...\r(Topo menu colors are stored in the file as web-style hex RGB)\r  Red=#ff0000, Yellow=#ffff00, Green=#008000, Blue=#000080,\r  Purple=#800080, Black=#000000, White=#ffffff\r(Topo solid  line widths: Hairline=1, Thin=2, Medium=3, Thick=4)\r(Topo dashed line widths: Hairline=1, Thin=2)\rSRE's tpo.c mod stuffs Style/Width/Dashed/Color fields into &quot;desc&quot; field\r  under the assumption that something will post-process GPX or KML output\r  and move information from desc to private extensions\r(solid  lines have &quot;Dashed=0&quot;, can have width of 1=hairline to 4=thick)\r(dashed lines have &quot;Dashed=1&quot;, can only have width of 1=hairline or 2=thin)\r</cmt>
+    <desc>how GPX from GPSBabel shows Topo track desc as of 2012:\r(line name and line style are NOT related to actual color or width)\r\r&lt;trk&gt;\r  &lt;name&gt;red line&lt;/name&gt;\r  &lt;desc&gt;Style=red med, Width=3, Dashed=0, Color=#ff0000&lt;/desc&gt;\r&lt;number&gt;1&lt;/number&gt;\r&lt;trkseg&gt;\r...\r(Topo menu colors are stored in the file as web-style hex RGB)\r  Red=#ff0000, Yellow=#ffff00, Green=#008000, Blue=#000080,\r  Purple=#800080, Black=#000000, White=#ffffff\r(Topo solid  line widths: Hairline=1, Thin=2, Medium=3, Thick=4)\r(Topo dashed line widths: Hairline=1, Thin=2)\rSRE's tpo.c mod stuffs Style/Width/Dashed/Color fields into &quot;desc&quot; field\r  under the assumption that something will post-process GPX or KML output\r  and move information from desc to private extensions\r(solid  lines have &quot;Dashed=0&quot;, can have width of 1=hairline to 4=thick)\r(dashed lines have &quot;Dashed=1&quot;, can only have width of 1=hairline or 2=thin)\r</desc>
   </wpt>
   <wpt lat="37.522691488" lon="-122.288962007">
     <name>NOTE 3</name>
-    <cmt>how KML from GPSBabel shows Topo track desc as of 2012: (see important notes with GPX sample, all of them apply here!) (note that GPSBabel forces all track styles to be the same - why?)      &lt;Folder&gt;       &lt;name&gt;Tracks&lt;/name&gt;       &lt;Folder&gt;         &lt;name&gt;red line&lt;/name&gt;         &lt;snippet/&gt;         &lt;description&gt; &lt;![CDATA[&lt;table&gt;             &lt;tr&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt; Style=Red Medium, Width=3, Dashed=0, Color=#ff0000 &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt;&lt;b&gt;Distance&lt;/b&gt; 1.3 mi &lt;/td&gt;&lt;/tr&gt;           &lt;/table&gt;]]&gt;         &lt;/description&gt;         &lt;Folder&gt;           &lt;name&gt;Points&lt;/name&gt;           &lt;Placemark&gt;             &lt;name&gt;red line-0&lt;/name&gt; ...</cmt>
-    <desc>how KML from GPSBabel shows Topo track desc as of 2012: (see important notes with GPX sample, all of them apply here!) (note that GPSBabel forces all track styles to be the same - why?)      &lt;Folder&gt;       &lt;name&gt;Tracks&lt;/name&gt;       &lt;Folder&gt;         &lt;name&gt;red line&lt;/name&gt;         &lt;snippet/&gt;         &lt;description&gt; &lt;![CDATA[&lt;table&gt;             &lt;tr&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt; Style=Red Medium, Width=3, Dashed=0, Color=#ff0000 &lt;/td&gt;&lt;/tr&gt;             &lt;tr&gt;&lt;td&gt;&lt;b&gt;Distance&lt;/b&gt; 1.3 mi &lt;/td&gt;&lt;/tr&gt;           &lt;/table&gt;]]&gt;         &lt;/description&gt;         &lt;Folder&gt;           &lt;name&gt;Points&lt;/name&gt;           &lt;Placemark&gt;             &lt;name&gt;red line-0&lt;/name&gt; ...</desc>
+    <cmt>how KML from GPSBabel shows Topo track desc as of 2012:\r(see important notes with GPX sample, all of them apply here!)\r(note that GPSBabel forces all track styles to be the same - why?)\r\r    &lt;Folder&gt;\r      &lt;name&gt;Tracks&lt;/name&gt;\r      &lt;Folder&gt;\r        &lt;name&gt;red line&lt;/name&gt;\r        &lt;snippet/&gt;\r        &lt;description&gt;\r&lt;![CDATA[&lt;table&gt;\r            &lt;tr&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt; Style=Red Medium, Width=3, Dashed=0, Color=#ff0000 &lt;/td&gt;&lt;/tr&gt;\r            &lt;tr&gt;&lt;td&gt;&lt;b&gt;Distance&lt;/b&gt; 1.3 mi &lt;/td&gt;&lt;/tr&gt;\r          &lt;/table&gt;]]&gt;\r        &lt;/description&gt;\r        &lt;Folder&gt;\r          &lt;name&gt;Points&lt;/name&gt;\r          &lt;Placemark&gt;\r            &lt;name&gt;red line-0&lt;/name&gt;\r...</cmt>
+    <desc>how KML from GPSBabel shows Topo track desc as of 2012:\r(see important notes with GPX sample, all of them apply here!)\r(note that GPSBabel forces all track styles to be the same - why?)\r\r    &lt;Folder&gt;\r      &lt;name&gt;Tracks&lt;/name&gt;\r      &lt;Folder&gt;\r        &lt;name&gt;red line&lt;/name&gt;\r        &lt;snippet/&gt;\r        &lt;description&gt;\r&lt;![CDATA[&lt;table&gt;\r            &lt;tr&gt;&lt;td&gt;&lt;b&gt;Description&lt;/b&gt; Style=Red Medium, Width=3, Dashed=0, Color=#ff0000 &lt;/td&gt;&lt;/tr&gt;\r            &lt;tr&gt;&lt;td&gt;&lt;b&gt;Distance&lt;/b&gt; 1.3 mi &lt;/td&gt;&lt;/tr&gt;\r          &lt;/table&gt;]]&gt;\r        &lt;/description&gt;\r        &lt;Folder&gt;\r          &lt;name&gt;Points&lt;/name&gt;\r          &lt;Placemark&gt;\r            &lt;name&gt;red line-0&lt;/name&gt;\r...</desc>
   </wpt>
   <wpt lat="37.522104979" lon="-122.272938490">
     <name>NOTE 4</name>
-    <cmt>how MapSource 6.16.3 adds color to a track as of 2012: (color choices are Dark Gray, Red, Green, Yellow, Blue, Magenta, Cyan, White, Transparent) (should be easy to turn desc tag into their extension, but better to directly write track styles)    &lt;trk&gt;     &lt;name&gt;Hwy 50 from Placerville&lt;/name&gt;     &lt;extensions&gt;       &lt;gpxx:TrackExtension xmlns:gpxx=&quot;http://www.garmin.com/xmlschemas/GpxExtensions/v3&quot;&gt;         &lt;gpxx:DisplayColor&gt;Red&lt;/gpxx:DisplayColor&gt;       &lt;/gpxx:TrackExtension&gt;     &lt;/extensions&gt;     &lt;trkseg&gt; ... </cmt>
-    <desc>how MapSource 6.16.3 adds color to a track as of 2012: (color choices are Dark Gray, Red, Green, Yellow, Blue, Magenta, Cyan, White, Transparent) (should be easy to turn desc tag into their extension, but better to directly write track styles)    &lt;trk&gt;     &lt;name&gt;Hwy 50 from Placerville&lt;/name&gt;     &lt;extensions&gt;       &lt;gpxx:TrackExtension xmlns:gpxx=&quot;http://www.garmin.com/xmlschemas/GpxExtensions/v3&quot;&gt;         &lt;gpxx:DisplayColor&gt;Red&lt;/gpxx:DisplayColor&gt;       &lt;/gpxx:TrackExtension&gt;     &lt;/extensions&gt;     &lt;trkseg&gt; ... </desc>
+    <cmt>how MapSource 6.16.3 adds color to a track as of 2012:\r(color choices are Dark Gray, Red, Green, Yellow, Blue, Magenta, Cyan, White, Transparent)\r(should be easy to turn desc tag into their extension, but better to directly write track styles)\r\r  &lt;trk&gt;\r    &lt;name&gt;Hwy 50 from Placerville&lt;/name&gt;\r    &lt;extensions&gt;\r      &lt;gpxx:TrackExtension xmlns:gpxx=&quot;http://www.garmin.com/xmlschemas/GpxExtensions/v3&quot;&gt;\r        &lt;gpxx:DisplayColor&gt;Red&lt;/gpxx:DisplayColor&gt;\r      &lt;/gpxx:TrackExtension&gt;\r    &lt;/extensions&gt;\r    &lt;trkseg&gt;\r...\r</cmt>
+    <desc>how MapSource 6.16.3 adds color to a track as of 2012:\r(color choices are Dark Gray, Red, Green, Yellow, Blue, Magenta, Cyan, White, Transparent)\r(should be easy to turn desc tag into their extension, but better to directly write track styles)\r\r  &lt;trk&gt;\r    &lt;name&gt;Hwy 50 from Placerville&lt;/name&gt;\r    &lt;extensions&gt;\r      &lt;gpxx:TrackExtension xmlns:gpxx=&quot;http://www.garmin.com/xmlschemas/GpxExtensions/v3&quot;&gt;\r        &lt;gpxx:DisplayColor&gt;Red&lt;/gpxx:DisplayColor&gt;\r      &lt;/gpxx:TrackExtension&gt;\r    &lt;/extensions&gt;\r    &lt;trkseg&gt;\r...\r</desc>
   </wpt>
   <trk>
     <name>red thick</name>
diff --git a/gpsbabel/src/core/xmlstreamwriter.cc b/gpsbabel/src/core/xmlstreamwriter.cc
new file mode 100644 (file)
index 0000000..abfb230
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+    Copyright (C) 2013 Robert Lipe, gpsbabel.org
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+
+#include <src/core/xmlstreamwriter.h>
+#include <QtCore/QtGlobal>
+
+#include <QtCore/QFile>
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+#include <QtCore/QRegExp>
+#else
+#include <QtCore/QRegularExpression>
+#endif
+#include <QtCore/QXmlStreamWriter>
+
+// As this code began in C, we have several hundred places that write
+// c strings.  Add a test that the string contains anything useful
+// before serializing an empty tag.
+// We also strip out characters that are illegal in xml.  These can creep
+// into our structures from other formats where they are legal.
+
+namespace gpsbabel
+{
+
+XmlStreamWriter:: XmlStreamWriter(QString* s) : QXmlStreamWriter(s) {}
+
+XmlStreamWriter::XmlStreamWriter(QFile* f) : QXmlStreamWriter(f) {}
+
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+QRegExp XmlStreamWriter::badXml10 = QRegExp("[\\x0000-\\x0008]|[\\x000b-\\x000c]|[\\x000e-\\x001f]");
+#else
+QRegularExpression XmlStreamWriter::badXml10 = QRegularExpression("[\\x00-\\x08]|[\\x0b-\\x0c]|[\\x0e-\\x1f]");
+#endif
+
+// Dont emit the attribute if there's nothing interesting in it.
+void XmlStreamWriter::writeOptionalAttribute(const QString& qualifiedName, QString value)
+{
+  if (!value.isEmpty()) {
+    QXmlStreamWriter::writeAttribute(qualifiedName, value.replace(badXml10, " "));
+  }
+}
+
+// Dont emit the element if there's nothing interesting in it.
+void XmlStreamWriter::writeOptionalTextElement(const QString& qualifiedName, QString text)
+{
+  if (!text.isEmpty()) {
+    QXmlStreamWriter::writeTextElement(qualifiedName, text.replace(badXml10, " "));
+  }
+}
+
+void XmlStreamWriter::writeAttribute(const QString& qualifiedName, QString value)
+{
+  QXmlStreamWriter::writeAttribute(qualifiedName, value.replace(badXml10, " "));
+}
+
+void XmlStreamWriter::writeCDATA(QString text)
+{
+  QXmlStreamWriter::writeCDATA(text.replace(badXml10, " "));
+}
+
+void XmlStreamWriter::writeCharacters(QString text)
+{
+  QXmlStreamWriter::writeCharacters(text.replace(badXml10, " "));
+}
+
+void XmlStreamWriter::writeTextElement(const QString& qualifiedName, QString value)
+{
+  QXmlStreamWriter::writeTextElement(qualifiedName, value.replace(badXml10, " "));
+}
+
+} // namespace gpsbabel
index a0239f410c0331fd52a9cb933874317390dfc3fb..5a15f3a5eb12f7a45e484264d44b661acd83b45c 100644 (file)
 
  */
 
-#include <QtCore/QFile>
-#include <QtCore/QXmlStreamWriter>
+#ifndef XMLSTREAMWRITER_H
+#define XMLSTREAMWRITER_H
 
-// As this code began in C, we have several hundred places that write
-// c strings.  Add a test that the string contains anything useful
-// before serializing an empty tag.
+#include <QtCore/QtGlobal>
+#include <QtCore/QXmlStreamWriter>
 
-namespace gpsbabel {
+class QFile;
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+class QRegExp;
+#else
+class QRegularExpression;
+#endif
+
+namespace gpsbabel
+{
+
+class XmlStreamWriter : public QXmlStreamWriter
+{
+private:
+#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
+  static QRegExp badXml10;
+#else
+  static QRegularExpression badXml10;
+#endif
 
-class XmlStreamWriter : public QXmlStreamWriter {
 public:
-  XmlStreamWriter(QString* s) : QXmlStreamWriter(s) {}
-  XmlStreamWriter(QFile* f) : QXmlStreamWriter(f) {}
-
-  // Dont emit the attribute if there's nothing interesting in it.
-  void writeOptionalAttribute(QString tag, QString value) {
-    if (!value.isEmpty()) {
-      writeAttribute(tag, value);
-    }
-  }
-
-  // Dont emit the tag if there's nothing interesting in it.
-  void writeOptionalTextElement(QString tag, QString value) {
-    if (!value.isEmpty()) {
-      writeTextElement(tag, value);
-    }
-  }
+  XmlStreamWriter(QString* s);
+  XmlStreamWriter(QFile* f);
+
+  void writeOptionalAttribute(const QString& qualifiedName, QString value);
+  void writeOptionalTextElement(const QString& qualifiedName, QString text);
+  void writeAttribute(const QString& qualifiedName, QString value);
+  void writeCDATA(QString text);
+  void writeCharacters(QString text);
+  void writeTextElement(const QString& qualifiedName, QString value);
 
 };
 
-}; // namespace gpsbabel
+} // namespace gpsbabel
+
+#endif // XMLSTREAMWRITER_H
+